package com.lyc.api;

import com.lyc.constants.Constants;
import com.lyc.utils.HttpClient;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: lyc
 * @Date: 2024/11/23 下午3:45
 */
public class KhApiClient {

    public static void batchKhGgw(String name, String daima, Integer ecpm) {
        String url = "http://juhe.kuhuan.club/api/juhe.guanggaoweis/add_ggw";

        Map<String, Object> params = new HashMap<>();
        params.put("name", name); // 广告源
        params.put("daima", daima); // 代码位ID
        params.put("ecpm", ecpm); // ecpm
        params.put("px_switch", 1); // 竞价
        params.put("app_id", 3); // appId
        params.put("guanggaowangluo_id", 1); // 广告网络
        params.put("guanggaowei_id", 100008); //广告位
        params.put("list", 4); // 类型

        Map<String, String> headers = getHeaders();

        String response = HttpClient.doPost("http://juhe.kuhuan.club/api/juhe.guanggaoyuan/add_ggw", params, headers);
        System.out.println("response = " + response);
    }

    private static Map<String, String> getHeaders() {
        Map<String, String> headers = new HashMap<>();
        headers.put("Content-Type", "application/json");
        headers.put("Token", Constants.KH_TOKEN);
        return headers;
    }
}
